package com.itheima.reggie.controller;

import com.itheima.reggie.common.R;
import com.itheima.reggie.entity.User;
import com.itheima.reggie.service.UserService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpSession;
import java.util.Map;

@RestController
@RequestMapping("/user")
@Slf4j
public class UserController {
 @Autowired
 private UserService userService;
 @PostMapping("/sendMsg")
 public R<String> sendMsg(HttpSession session, @RequestBody User user){
  R<String> stringR = userService.sendMsg(session, user);

  return stringR;
 }
 @PostMapping("/login")
 public R<User> login(@RequestBody Map map, HttpSession session){
  R<User> login = userService.login(map, session);
  return login;
 }


}
